package games.Gobang;

import javax.swing.*;
import java.awt.*;

/**
 * Created by Administrator on 2017/2/8.
 */
public class Window extends JFrame{

    static JButton button[]=new JButton[210];
    int buttonCount=0;

    public Window(){
        setLayout(null);
        setBounds(450,75,700,750);
        setVisible(true);
        setBackground(Color.pink);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setTitle("games/Gobang");
    }

    public void paint(Graphics g){
        g.setColor(Color.gray);
        int x1=100,y1=100;
        int x2=620,y2=100;
        for(int i=0;i<=14;i++){
            g.drawLine(x1,y1,x2,y2);
            y1=y1+40; y2=y2+40;
        }

        x1=100;  y1=100;
        x2=100;  y2=660;

        for(int i=0;i<=13;i++){
            g.drawLine(x1,y1,x2,y2);
            x1=x1+40;  x2=x2+40;
        }
    }

    public  void addButton(){
        for(int i=0;i<210;i++){
            button[i]=new JButton();
        }
        int x1=85,y1=65;
        for(int a=0;a<=14;a++){
            for(int b=0;b<=13;b++){
                this.add(button[buttonCount]);
                button[buttonCount].setBounds(x1,y1,10,10);
                buttonCount++;
                x1=x1+40;
            }
            x1=85; y1=y1+40;
        }
    }

}


